package com.xiangyang.controller;

import com.xiangyang.entity.dto.Result;
import com.xiangyang.service.IFileUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/api")
public class FileUploadController {

    @Autowired
    private IFileUploadService fileUploadService;
    @PostMapping("/upload")
    public Result uploadFile(@RequestParam("file") MultipartFile file) throws IOException {
            return fileUploadService.avatarFile(file);
    }
}